<?php echo $header; ?>
<div id="columnswrapper">
	<?php echo $column_left; ?>
	<div id="content">
		<div class="inner">
      <h2><?php echo $heading_title; ?></h2>

  <div class="middle"><b><?php echo $text_critea; ?></b>
    <div id="content_search" style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 3px; margin-bottom: 10px;">
      <table>
        <tr>
          <td><?php echo $entry_search; ?></td>
          <td><?php if ($keyword) { ?>
            <input type="text" value="<?php echo $keyword; ?>" id="keyword" />
            <?php } else { ?>
            <input type="text" value="<?php echo $text_keyword; ?>" id="keyword" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" />
            <?php } ?>
            <select id="category_id">
              <option value="0"><?php echo $text_category; ?></option>
              <?php foreach ($categories as $category) { ?>
              <?php if ($category['category_id'] == $category_id) { ?>
              <option value="<?php echo $category['category_id']; ?>" selected="selected"><?php echo $category['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select></td>
        </tr>
        <tr>
          <td colspan="2"><?php if ($description) { ?>
            <input type="checkbox" name="description" id="description" checked="checked" />
            <?php } else { ?>
            <input type="checkbox" name="description" id="description" />
            <?php } ?>
            <?php echo $entry_description; ?></td>
        </tr>
		
      </table>
    </div>
    <div style="margin-bottom:15px;">
      <table>
        <tr>
          <td align="right"><a style="cursor: pointer;padding:6px 20px;" id="change" onclick="contentSearch();" class="button"><span><?php echo $button_search; ?></span></a></td>
        </tr>
      </table>
    </div>
    <h3><?php echo $text_search; ?></h3>
    <?php if (isset($products)) { ?>
		    <div class="sort">
		      <div class="div1">
		      <div class="div2"><?php echo $text_sort; ?>
		        <select name="sort" onchange="location = this.value">
		          <?php foreach ($sorts as $sorts) { ?>
		          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
		          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
		          <?php } else { ?>
		          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
		          <?php } ?>
		          <?php } ?>
		        </select></div>
		      </div>
		      
		    </div>
		    <table>
		    <?php for ($i = 0; $i < sizeof($products); $i=$i+2) { ?>
		    <tr style="clear:both;float:left;width:720px;margin-top:20px;">
		    <?php for ($j = $i; $j < $i+2; $j++) { ?>
		    <td><?php if (isset($products[$j])) { ?>
			<div class="searchresult">	
			 <?php if($products[$j]['stock']==2){?>
			<div class="banner-small reduced"></div>
			<?php }else{?>
			<div class="banner-small sold"></div>
			<?php }?>						
			<a href="<?php echo $products[$j]['href']; ?>"><img width="250" height="150" alt="<?php echo $products[$j]['name']; ?>" title="<?php echo $products[$j]['name']; ?>" src="<?php echo $products[$j]['thumb']; ?>" /></a>
			<div class="shadow-small"></div>			
			<h3 class="citystatezip"><?php echo $products[$j]['name'];?> </h3>
						
			</div><!-- end post -->
			</td>
			<?php }?>
			<?php }?>
			
			</tr>
			<?php }?>
			</table>
			<div style="clear:both;width:100%;"></div>
			<div class="pagination"><?php echo $pagination; ?></div>
			<?php } else { ?>
    <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 3px; margin-bottom: 15px;"><?php echo $text_empty; ?></div>
    <?php }?>
  </div>
  </div><!-- end inner -->
</div><!-- end content -->
	
<?php echo $column_right; ?>
</div><!-- end columnswrapper -->
<script type="text/javascript"><!--
$('#content_search input').keydown(function(e) {
	if (e.keyCode == 13) {
		contentSearch();
	}
});

function contentSearch() {
	url = 'index.php?route=product/search';
	
	var keyword = $('#keyword').attr('value');
	
	if (keyword) {
		url += '&keyword=' + encodeURIComponent(keyword);
	}

	var category_id = $('#category_id').attr('value');
	
	if (category_id) {
		url += '&category_id=' + encodeURIComponent(category_id);
	}
	
	if ($('#description').attr('checked')) {
		url += '&description=1';
	}
	
	location = url;
}
//--></script>
<?php echo $footer; ?> 